{include file='admin/before_body.phtml' title='后台首页'}
<style>
.permissions .checkbox-inline:first-child { margin-left: 10px; }
.permissions .checkbox-inline { padding-right: 20px;padding-left: 0px }
</style>
{include file='admin/header.phtml'}
    <div class="main-container" id="main-container">
      <script type="text/javascript">try { ace.settings.check('main-container' , 'fixed') }catch(e) {  }</script>
      <div class="main-container-inner">
        {include file='admin/sidebar.phtml' navigation='dashboard'}
        <div class="main-content">
{$breadcrumbs=[]}
{$breadcrumbs[] = ['name' => '用户设置', 'icon' => 'icon-home home-icon']}
{$breadcrumbs[] = ['name' => '角色管理', 'link' => url('admin/user/role')]}
{if isset($role)}
{$breadcrumbs[] = ['name' => '编辑权限 [ '|cat: $role->rolename|cat: ' ]', 'isactive' => true]}
{else}
{$breadcrumbs[] = ['name' => '新增角色', 'isactive' => true]}
{/if}
{include file='admin/breadcrumb.phtml' breadcrumbs=$breadcrumbs}
          <div class="page-content">
            {html_messages}
            <div class="row">
<div class="col-xs-12">
  <form method="post" class="form-horizontal" role="form">
    <h4 class="lighter">
      <i class="icon-hand-right icon-animated-hand-pointer blue"></i>
      <span class="pink"> 基本资料 </span>
    </h4>
    <div class="hr hr-18 hr-double dotted"></div>

    <div class="form-group">
      <label class="col-sm-3 control-label no-padding-right" for="rolename"> 角色名称 </label>
      <div class="col-sm-9">
        <input type="text" class="col-xs-10 col-sm-5" name="rolename" id="rolename" value="{$role->rolename|default:''}" />
      </div>
    </div>

    <div class="space-4"></div>
    <div class="form-group">
      <label class="col-sm-3 control-label no-padding-right">状态</label>
      <div class="col-xs-9">
        <label>
          <input class="ace ace-switch ace-switch-7" value='1' name="status" type="checkbox" {if isset($role) && $role->status == Role::IS_EFFECTIVE} checked="checked" {/if} />
          <span class="lbl"></span>
        </label>
      </div>
    </div>

    <h4 class="lighter">
      <i class="icon-hand-right icon-animated-hand-pointer blue"></i>
      <span class="pink"> 授权设置 </span>
    </h4>
    <div class="hr hr-18 hr-double dotted"></div>
{foreach $permissions as $name => $permission}
<div class="space-4"></div>
<div class="form-group">
  <label class="col-sm-3 control-label no-padding-right">{$name}</label>
  <div class="col-xs-8 permissions">
    {if !is_array($permission)}{$permission = [$permission]}{/if}
    {foreach $permission as $p}
      <label class="checkbox-inline">
        <input type="checkbox" class="ace" value="{$p->permission}" name="permissions[]"
         {if isset($role) && $role->checkPermission($p->permission)} checked="checked" {/if} >
        <span class="lbl"> {$p->description}</span>
      </label>
    {/foreach}
  </div>
</div>
{/foreach}
    <div class="clearfix form-actions">
      <div class="col-md-offset-3 col-md-9">
        <button class="btn btn-info" type="submit">
          <i class="icon-ok bigger-110"></i>保存
        </button>
        &nbsp; &nbsp; &nbsp;
        <a class="btn" href="{url('admin/user/role')}">
          <i class="icon-undo bigger-110"></i>
          返回列表
        </a>
      </div>
    </div>
  </form>
</div><!-- /.col -->






            </div>
          </div>
        </div>
      </div>
    </div>
</body>
{include file='admin/after_body.phtml'}
</html>

